package com.dtn.wsn.database;

import com.dtn.wsn.dao.DataDAO;
import com.dtn.wsn.entity.Data;



public class ConnectionPoolTest {   
    public static void main(String[] args) throws Exception {  
 
    	
        ConnectionPool connPool = new ConnectionPool("com.mysql.jdbc.Driver",   
                "jdbc:mysql://localhost:3306/Test", "root", "bytewalla5");   
  
        connPool.createPool();  
        
        DataDAO dataDao = new DataDAO(connPool);
        Data data = dataDao.queryDataBySpotname("spot1");
        System.out.println(data.getTemperature());
        
       /* Connection conn = connPool.getConnection();
        stmt = conn.createStatement();
        try {
            // Display all results
            rs = stmt.executeQuery("SELECT * from lightReadings ORDER BY timestamp");
            System.out.println("Collected sensor readings:");
            System.out.println("\t+--------------------------------------" +
                    "-----------------+");
            System.out.println("\t|      spotId       \t      timestamp  " +
                    " \treading |");
            System.out.println("\t+--------------------------------------" +
                    "-----------------+");
            while (rs.next()) {
                id = rs.getString("spotId");
                ts = rs.getString("timestamp");
                val = rs.getInt("reading");
                System.out.println("\t " + id + "\t" + ts + "\t   " + val);
            }    
            System.out.println("\t+--------------------------------------" +
                    "-----------------+");
        
        } catch (Exception e) {
            System.err.println("Caught " + e + " in analyzeData()");
            throw e;
        }*/
        
        connPool.closeConnectionPool();   
         
    }   
       
}  
